package com.first.nell.components.bill

import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.RelativeLayout
import android.widget.Toast
import androidx.fragment.app.FragmentManager
import com.first.nell.R
import com.first.nell.base.BaseFormAction
import com.first.nell.databinding.ViewFirstNellBillTablePeroidBinding


class PeroidBill : RelativeLayout, BaseFormAction {

    lateinit var mFirstNellViewFirstNellBinding: ViewFirstNellBillTablePeroidBinding
    private lateinit var vFirstNellRootFirstNellView: View

    private var mFirstNellSupportFirstNellFragmentFirstNellManager: FragmentManager? = null

    private var mFirstNellTempFirstNellInputFirstNellValue: String = ""
    private var mFirstNellOnFirstNellActionFirstNellClickFirstNellListener: (Int) -> Unit = {}

    constructor(context: Context?) : this(context, null)
    constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0)
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : this(
        context,
        attrs,
        defStyleAttr,
        0
    )

    @SuppressLint("Recycle")
    constructor(
        context: Context?,
        attrs: AttributeSet?,
        defStyleAttr: Int,
        defStyleRes: Int,
    ) : super(
        context,
        attrs,
        defStyleAttr,
        defStyleRes
    ) {
        context?.let {
            vFirstNellRootFirstNellView = View.inflate(it, R.layout.view_first_nell_bill_table_peroid, this)
            mFirstNellViewFirstNellBinding = ViewFirstNellBillTablePeroidBinding.bind(vFirstNellRootFirstNellView)
            initSubViews()
        }
    }

    private fun initSubViews() {

    }

    @SuppressLint("SetTextI18n")
    fun setMainDays(days: String) {
        mFirstNellViewFirstNellBinding.textBillTablePeroidMain.text = ("${days}days")
        mFirstNellViewFirstNellBinding.llBillTablePeroidHintBg.setOnClickListener {
            Toast.makeText(
                context,
                "Open after meeting the repayment requirements",
                Toast.LENGTH_SHORT
            ).show()
        }
    }

    override fun initFirstNellSubviews() {

    }

    override fun setFirstNellTitle(title: String) {

    }

    override fun setFirstNellDetail(detail: String) {

    }

    override fun setFirstNellContent(content: String) {

    }

    override fun setFirstNellHint(hint: String) {

    }

    override fun setFirstNellDetailFirstNellColor(detailColor: Int) {

    }

    override fun setFirstNellTitleFirstNellColor(titleColor: Int) {

    }

    override fun setFirstNellFragmentFirstNellManager(manager: FragmentManager) {
        mFirstNellSupportFirstNellFragmentFirstNellManager = manager
    }

    override fun setFirstNellOnFirstNellActionFirstNellClickFirstNellListener(listener: (Int) -> Unit) {
        mFirstNellOnFirstNellActionFirstNellClickFirstNellListener = listener
    }
}